#!/bin/bash
#!this is a cmdlet to list all mysql logs
let "count=0"
for myfile in /usr/local/mysql/var/mysql-bin.0*
do
#        echo $myfile
let "count=$count+1"
echo "count=$count"
done
echo "total $count files in date()"

let "count=$count-2"
echo "count-2=$count"

echo "good\n\n"
#date >>/var/mysqllog.txt
let "num=0"
for myfile in /usr/local/mysql/var/mysql-bin.0*
do
        let "num=$num+1"
        if [ $num -lt $count ]
        then
        rm -f $myfile
        echo "rm file $myfile of $num" >>/var/mysqllog.txt
        else
        echo "not rm file $myfile of $num" >>/var/mysqllog.txt
        fi
done
